package com.lanou3g.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
//@Aspect 切面注解
//直接在类中把整个切面都定义好了
public class AnnoAopDemo {
    @Pointcut("execution(* com.lanou3g.service.*.*(..))")
    //@Pointcut将方法声明成切点
    public void pt() {
    }

    @Around("pt()")
    public void around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("环绕前------------------------------");
        pjp.proceed();
        System.out.println("环绕后------------------------------");
    }
}
